Skip to content

Conversation

@mikejritter
Copy link
Contributor

@mikejritter mikejritter commented Jul 31, 2025

What does this do?

  • Use the new search API when querying
  • Use the new search list when required
  • Display thumbnails for grid and detail views
  • Replace getListType helper with two alternatives:
    • deriveSearchType which gets both the list type and search type (default, advanced)
    • getListTypeFromResult which reads the search result in order to match against the configured list types
  • CSS adjustments for grid and detail views

Why are we doing this? (with JIRA link)
Jira: https://collectionspace.atlassian.net/browse/DRYD-1832

This allows us to query against the new API and test what the views look like with the new response data. In addition it has updated the grid and detail list views to incorporate the thumbnail of an object when possible. There's still work around those views which will need to be done, such as displaying an image if it is not found or providing a warning for NAGPRA related media.

Additional changes were made to deal with passing the listType as a prop everything. I found that as I was testing different functionality, either the search action was being called incorrectly or something else would happen because the listType and potentially the isNewSearch flag were incorrect. I opted to refactor a little bit and allow us to get the listType from either the searchDescriptor or the searchResult so that the listType/isNewSearch props aren't as necessary and can be omitted. Most of this work was done in e2891ae and tests were updated in 4548504.

How should this be tested? Do these changes have associated tests?
To test locally:

  • Ensure all tests are passing
    • npm run lint
    • npm run test
  • Rebuild collectionspace off of the develop branch, e.g.
sdk use java 8.0.362-amzn
cd ./services
mvn clean install -Dmaven.test.skip=true
cd ../application
mvn clean install -Dmaven.test.skip=true
cd ../services
ant undeploy deploy create_db import
  • Start your Tomcat server which collectionspace is deployed in
  • Run the devserver: npm run devserver
  • Navigate to the cspace interface and check
    • That the main search interface is working
      • Navigation works when clicking on rows
      • The SearchResultTraveserver works when navigating in the record editor after clicking on a row
      • For objects specifically: The grid/list displays work and pull new data as expected
    • In the record editor:
      • Each of the panels is able to be populated (Media, Terms Used, Related Objects/Procedures, Used By (authority only))
      • Each of the actions for a panel (open/add) can be used
    • Elsewhere:
      • The Administration > Users page can be \used
      • The Administration > Roles and Permissions page can be used

Once the 403 issue with dev is resolved, instead of deploying locally this can be validated by using npm run devserver --back-end=https://core.dev.collectionspace.org

Dependencies for merging? Releasing to production?
The only thing I can think of is that it would be nice to have the tests use the same configuration as the application does when it starts up. I have work for that in another branch, which hopefully can be shared soon.

Has the application documentation been updated for these changes?
No

Did someone actually run this code to verify it works?
@mikejritter has only tested locally

@mikejritter mikejritter marked this pull request as ready for review September 2, 2025 21:03
@spirosdi spirosdi self-requested a review September 3, 2025 04:24
@spirosdi
Copy link

spirosdi commented Sep 3, 2025

Doing a QA check, I have found the following issue:
Grid View: Paginating leads to uncaught errors and white page.
Steps to reproduce:
a. Search for a query with multiple pages result
b. Switch to grid view and click page 2 button in the pagination
c. This results in a white page and the following console errors:

searchResultHelpers.js:85 Uncaught TypeError: Cannot read properties of undefined (reading 'get')
    at readListItems (searchResultHelpers.js:85:29)
    at SearchResultGrid (SearchResultGrid.jsx:107:84)
    at renderWithHooks (react-dom.development.js:14803:18)
    at updateFunctionComponent (react-dom.development.js:17034:20)
    at beginWork (react-dom.development.js:18610:16)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237:16)
    at invokeGuardedCallback (react-dom.development.js:292:31)
    at beginWork$1 (react-dom.development.js:23203:7)
    at performUnitOfWork (react-dom.development.js:22154:12)

hook.js:608 The above error occurred in the <SearchResultGrid> component:
    in SearchResultGrid (created by InjectIntl(SearchResultGrid))
    in InjectIntl(SearchResultGrid) (created by SearchResults)
    in div (created by SearchResults)
    in div (created by SearchResults)
    in div (created by SearchResults)
    in SearchResults (created by SearchResultRoute)
    in SearchResultRoute (created by Context.Consumer)
    in div (created by ProtectedPage)
    in ProtectedPage (created by Context.Consumer)
    in Route (created by ProtectedRoute)
    in ProtectedRoute (created by Connect(ProtectedRoute))
    in Connect(ProtectedRoute) (created by RootPage)
    in Switch (created by RootPage)
    in div (created by RootPage)
    in RootPage (created by InjectIntl(RootPage))
    in InjectIntl(RootPage) (created by WithClassName)
    in WithClassName (created by Context.Consumer)
    in Route (created by App)
    in Switch (created by App)
    in Router (created by BrowserRouter)
    in BrowserRouter (created by App)
    in ConfigProvider (created by App)
    in Provider (created by App)
    in IntlProvider (created by App)
    in App (created by Connect(App))
    in Connect(App)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
react-dom.development.js:11102 Uncaught TypeError: Cannot read properties of undefined (reading 'get')
    at readListItems (searchResultHelpers.js:85:29)
    at SearchResultGrid (SearchResultGrid.jsx:107:84)
    at renderWithHooks (react-dom.development.js:14803:18)
    at updateFunctionComponent (react-dom.development.js:17034:20)
    at beginWork (react-dom.development.js:18610:16)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237:16)
    at invokeGuardedCallback (react-dom.development.js:292:31)
    at beginWork$1 (react-dom.development.js:23203:7)
    at performUnitOfWork (react-dom.development.js:22154:12)

@mikejritter
Copy link
Contributor Author

@spirosdi Thanks, I was still thinking about the best way to get the list-items out of the response and it looks like for the Grid/Detail List func I didn't add any null safety. I might have some time to update it today since it should be a quick update.

@spirosdi
Copy link

spirosdi commented Sep 4, 2025

QA issue: The Traverser is not shown when navigating to the record editor after clicking the list item in the "grid" layout. It works fine in the "table".

@spirosdi
Copy link

spirosdi commented Sep 4, 2025

QA issue: The Traverser is not shown when navigating to the record editor after clicking the list item in the "grid" layout. It works fine in the "table".

Actually the issue is not related to the current updates. It already appears in development branch. The best is to fix it in another task and PR, in order not to bloat the current one. Here the task: https://collectionspace.atlassian.net/browse/DRYD-1890

@spirosdi spirosdi self-requested a review September 8, 2025 13:41
@spirosdi
Copy link

@mikejritter , now that collectionspace/services#475 is merged, we can merge this one too, right? Please let me know if you need any help with resolving the merge conflicts

@mikejritter
Copy link
Contributor Author

@spirosdi Yep, I checked yesterday and saw that the /advancedsearch endpoint is able to be used on dev. I'll go through the conflicts today and get the branch ready to be merged.

@mikejritter mikejritter merged commit ddf2587 into collectionspace:develop Sep 30, 2025
2 checks passed
@mikejritter mikejritter deleted the dryd-1804-api branch September 30, 2025 22:09
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (5fe10ea) to head (b598858).
⚠️ Report is 1 commits behind head on develop.

❌ Your project status has failed because the head coverage (0.00%) is below the target coverage (95.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@      Coverage Diff       @@
##   develop   #279   +/-   ##
==============================
==============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants